from django.db import models

# Create your models here.
from bloguser.models import UserProfile


class Article(models.Model):
    art_title = models.CharField(max_length=128, verbose_name='文章标题')
    author = models.ForeignKey(UserProfile, on_delete=models.CASCADE, verbose_name='文章作者')
    art_body = models.TextField(verbose_name='文章内容')
    created_time = models.DateTimeField(auto_now_add=True, verbose_name='写作时间')
    # 文章更新时间
    updated_time = models.DateTimeField(auto_now=True, verbose_name='最近更新时间')

    class Meta:
        db_table = 'article'
        verbose_name = '文章'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.art_title
